package com.cap.dreamcircle.View;

import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.cap.dreamcircle.App.App;
import com.cap.dreamcircle.Base.BaseActivity;
import com.cap.dreamcircle.Model.Action.NickNameAction;
import com.cap.dreamcircle.R;
import com.cap.dreamcircle.Utils.ToastUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;

/**
 * Created by liucxu on 2017/7/13.
 */

public class NickNameActivity extends BaseActivity {

    @BindView(R.id.edt_nick_name)
    EditText edt_nick_name;
    @BindView(R.id.tv_confirm)
    TextView tv_confirm;

    @Override
    public int getLayoutId() {
        return R.layout.activity_nick_name;
    }

    @Override
    public void setupView() {
        ButterKnife.bind(this);
    }

    @Override
    public void setupData() {

    }


    @OnClick({R.id.imv_back,R.id.tv_confirm})
    void doButtonClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.imv_back:
                App.GetInstance().finishActivity(NickNameActivity.this);
                break;
            case R.id.tv_confirm:
                if (TextUtils.isEmpty(edt_nick_name.getText().toString())) {
                    ToastUtils.showShortToast(NickNameActivity.this, "请输入昵称");
                } else {
                    NickNameAction nickNameAction=new NickNameAction();
                    nickNameAction.setNickName(edt_nick_name.getText().toString());
                    EventBus.getDefault().post(nickNameAction);
                    App.GetInstance().finishActivity(NickNameActivity.this);
                }
                break;
        }
    }
}
